﻿using System.Text.Json;

namespace QW.Core.Tester
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //SnowflakeId.Init(2, new DateTimeOffset(new DateTime(2010, 1, 1, 0, 0, 0)).ToUnixTimeMilliseconds());

            var tid = 2090921340117721088L;
            var snow2 = new SnowflakeId(tid, new DateTimeOffset(new DateTime(2010, 1, 1, 0, 0, 0)).ToUnixTimeMilliseconds());
            Console.WriteLine($"{tid} 基于2010的时间:{snow2.DateTime}");

            var _id = SnowflakeId.NextId();
            Console.WriteLine($"雪花Id:{_id}        小基于2010时间：{tid - _id}");
            var snow = new SnowflakeId(_id);
            Console.WriteLine($"时间:{snow.DateTime}");
            Console.WriteLine(JsonSerializer.Serialize(snow));


            Console.WriteLine("End");
            Console.ReadLine();
        }
    }
}
